﻿using System;
using System.Drawing;

namespace Crm.Utilities.SolutionsDeploymentTool.UI.Helpers
{
    public class ExecutionMessage
    {
        public String Text { get; set; }
        public MessageSeverity Severity { get; set; }
        public Color ColorCode { get; set; }

        public ExecutionMessage(string msg)
        {
            Text = msg;
            Severity = MessageSeverity.Information;
            ColorCode = Color.Black;
        }

        public ExecutionMessage(string msg, MessageSeverity severity)
        {
            Text = msg;
            Severity = severity;

            switch (Severity)
            {
                case MessageSeverity.Error:
                    ColorCode = Color.Red;
                    if (!string.IsNullOrEmpty(msg))
                        Text = string.Concat(Constants.Message_Error, " | ", msg);
                    else
                        Text = Constants.Message_Error;
                    break;
                case MessageSeverity.Warning:
                    ColorCode = Color.Orange;
                    if (!string.IsNullOrEmpty(msg))
                        Text = string.Concat(Constants.Message_Warning, " | ", msg);
                    else
                        Text = Constants.Message_Warning;;
                    break;
                case MessageSeverity.Success:
                    ColorCode = Color.Green;
                    if (!string.IsNullOrEmpty(msg))
                        Text = string.Concat(Constants.Message_Success, " | ", msg);
                    else
                        Text = Constants.Message_Success;
                    break;
                default:
                    ColorCode = Color.Black;
                    Text = msg;
                    break;
            }
        }
    }

}
